/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model.service.impl;

import model.service.ActaReunionService;
import model.dao.ActaReunionDao;
import java.util.List;
import model.bean.ActaReunion;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Archivo ActaReunionServiceImpl.java
 * @Fecha                @Autor   @Cambios
 * 21/01/2011 03:34:32 PM       moshiro
 */
@Service
public class ActaReunionServiceImpl implements ActaReunionService {

    @Autowired
    private ActaReunionDao actaReunionDao;

    @Override
    public Long agregarActaReunion(ActaReunion actaReunion) throws Exception {
        return actaReunionDao.agregarActaReunion(actaReunion);
    }

    @Override
    public Integer modificarActaReunion(ActaReunion actaReunion) throws Exception {
        return actaReunionDao.modificarActaReunion(actaReunion);
    }

    @Override
    public Integer cerrarActaReunion(Long codigo) throws Exception {
        return actaReunionDao.cerrarActaReunion(codigo);
    }

    @Override
    public Integer eliminarActaReunion(Long codigo) throws Exception {
        return actaReunionDao.eliminarActaReunion(codigo);
    }

    @Override
    public List<ActaReunion> listarActaReunion(ActaReunion actaReunion) throws Exception {
        if (actaReunion.getFecha() != null && actaReunion.getFecha() != "") {
            java.util.Date fecha = (new java.text.SimpleDateFormat("dd/MM/yyyy")).parse(actaReunion.getFecha());
            actaReunion.setFecha((new java.text.SimpleDateFormat("yyyy/MM/dd")).format(fecha));
        }
        return actaReunionDao.listarActaReunion(actaReunion);
    }

    @Override
    public ActaReunion obtenerActaReunion(ActaReunion actaReunion) throws Exception {
        List<ActaReunion> listado = actaReunionDao.listarActaReunion(actaReunion);
        return !listado.isEmpty() ? listado.get(0) : null;
    }
}
